package com.niit.musicserve.service.impl;

import com.niit.musicserve.dao.RankSongMapper;
import com.niit.musicserve.entity.RankSong;
import com.niit.musicserve.service.RankSongService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RankSongServiceImpl implements RankSongService {
	
	@Autowired
	private RankSongMapper rankSongMapper;
	
	@Override
	public boolean insertRankSong(RankSong rankSong) {
		return rankSongMapper.insertRankSong(rankSong) > 0;
	}
	
	@Override
	public boolean deleteRankSong(int rankSongId) {
		return rankSongMapper.deleteRankSong(rankSongId) > 0;
	}
	
	@Override
	public boolean deleteRankSongByRankIdAndSongId(
		int rankId,
		int songId)
	{
		return rankSongMapper.deleteRankSongByRankIdAndSongId(rankId, songId) > 0;
	}
	
	@Override
	public boolean updateRankSong(RankSong rankSong) {
		return rankSongMapper.updateRankSong(rankSong) > 0;
	}
	
	@Override
	public RankSong selectByPrimaryKey(int rankSongId) {
		return rankSongMapper.selectByPrimaryKey(rankSongId);
	}
	
	@Override
	public List<RankSong> allRankSong() {
		return rankSongMapper.allRankSong();
	}
	
	@Override
	public List<RankSong> rankSongByRankId(int rankId) {
		return rankSongMapper.rankSongByRankId(rankId);
	}
}
